import 'package:nyh_motorcade_app/entity/company_motorcade_card_entity.dart';

companyMotorcadeCardEntityFromJson(CompanyMotorcadeCardEntity data, Map<String, dynamic> json) {
	if (json['companyList'] != null) {
		data.companyList = (json['companyList'] as List).map((v) => CompanyMotorcadeCardList().fromJson(v)).toList();
	}
	if (json['motorcadeList'] != null) {
		data.motorcadeList = (json['motorcadeList'] as List).map((v) => CompanyMotorcadeCardList().fromJson(v)).toList();
	}
	if (json['cardList'] != null) {
		data.cardList = (json['cardList'] as List).map((v) => CompanyMotorcadeCardList().fromJson(v)).toList();
	}
	return data;
}

Map<String, dynamic> companyMotorcadeCardEntityToJson(CompanyMotorcadeCardEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['companyList'] =  entity.companyList?.map((v) => v.toJson())?.toList();
	data['motorcadeList'] =  entity.motorcadeList?.map((v) => v.toJson())?.toList();
	data['cardList'] =  entity.cardList?.map((v) => v.toJson())?.toList();
	return data;
}

companyMotorcadeCardListFromJson(CompanyMotorcadeCardList data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'].toString();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['code'] != null) {
		data.code = json['code'].toString();
	}
	if (json['accountType'] != null) {
		data.accountType = json['accountType'].toString();
	}
	if (json['availableAmount'] != null) {
		data.availableAmount = json['availableAmount'] is String
				? double.tryParse(json['availableAmount'])
				: json['availableAmount'].toDouble();
	}
	return data;
}

Map<String, dynamic> companyMotorcadeCardListToJson(CompanyMotorcadeCardList entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['code'] = entity.code;
	data['accountType'] = entity.accountType;
	data['availableAmount'] = entity.availableAmount;
	return data;
}